#ifndef __DEVICE_H__
#define __DEVICE_H__

#include <QObject>

#include <core/types.h>

struct st_device{
    const char * name;
    riscv_word_t attr;
    riscv_word_t base;
    riscv_word_t end;
    riscv_word_t rev0;

    st_device * next;   //单链表结构

    int (*read)(st_device *dev, riscv_word_t addr, uint8_t *data, int width);//读取接口
    int (*write)(st_device *dev, riscv_word_t addr, uint8_t *data, int width);//写入接口
};


void device_init(st_device *dev,
                 const char * name,
                 riscv_word_t attr,
                 riscv_word_t base,
                 riscv_word_t size);

#endif
